MEPS_IBTS_2

Andrew Edwards

Analyses of IBTS data using the original eight methods

This vignette analyses the IBTS data using the original eight methods, without accounting for the bin structure.

library(sizeSpectra)
data = IBTS_data
data
#> # A tibble: 42,298 x 7
#>     Year SpecCode LngtClass  Number    LWa   LWb bodyMass
#>    <int>    <int>     <dbl>   <dbl>  <dbl> <dbl>    <dbl>
#>  1  1986   105814        45 0.00714 0.0031  3.03     315.
#>  2  1986   105814        46 0.00714 0.0031  3.03     337.
#>  3  1986   105814        50 0.00714 0.0031  3.03     434.
#>  4  1986   105814        52 0.0293  0.0031  3.03     489.
#>  5  1986   105814        53 0.0109  0.0031  3.03     518.
#>  6  1986   105814        54 0.0113  0.0031  3.03     548.
#>  7  1986   105814        56 0.0218  0.0031  3.03     612.
#>  8  1986   105814        57 0.0188  0.0031  3.03     646.
#>  9  1986   105814        58 0.0381  0.0031  3.03     680.
#> 10  1986   105814        59 0.0327  0.0031  3.03     717.
#> # ... with 42,288 more rows

Each row of data is a unique combination of year, species code and length class. The Number column is the number of observed individuals of that species in that length class in that year, bodyMass is the body mass of such an individual, and LWa and LWb are the length-weight coefficients, used to calculate bodyMass. To verify that each row is a unique combination of year, species code and length class:

data
#> # A tibble: 42,298 x 7
#>     Year SpecCode LngtClass  Number    LWa   LWb bodyMass
#>    <int>    <int>     <dbl>   <dbl>  <dbl> <dbl>    <dbl>
#>  1  1986   105814        45 0.00714 0.0031  3.03     315.
#>  2  1986   105814        46 0.00714 0.0031  3.03     337.
#>  3  1986   105814        50 0.00714 0.0031  3.03     434.
#>  4  1986   105814        52 0.0293  0.0031  3.03     489.
#>  5  1986   105814        53 0.0109  0.0031  3.03     518.
#>  6  1986   105814        54 0.0113  0.0031  3.03     548.
#>  7  1986   105814        56 0.0218  0.0031  3.03     612.
#>  8  1986   105814        57 0.0188  0.0031  3.03     646.
#>  9  1986   105814        58 0.0381  0.0031  3.03     680.
#> 10  1986   105814        59 0.0327  0.0031  3.03     717.
#> # ... with 42,288 more rows
unique = dim(dplyr::summarise(dplyr::group_by(data,
                                              Year,
                                              SpecCode,
                                              LngtClass),
                              count=dplyr::n()))[1]
unique
#> [1] 42298

if( unique != dim(data)[1]) stop("something wrong with 'data'")

See if the number of length classes or species seems to change over time:

dataSumm = dplyr::summarise(dplyr::group_by(data, Year),
                            uniqLngtClass = length(unique(LngtClass)),
                            uniqSpec = length(unique(SpecCode)))
par(mfrow=c(2,1)) #7,1))

plot(dataSumm$Year, dataSumm$uniqLngtClass, xlab="Year",
     ylab="No. unique length classes", type="o",
     ylim=c(0, max(dataSumm$uniqLngtClass)))
plot(dataSumm$Year, dataSumm$uniqSpec, xlab="Year",
     ylab="No. unique species", type="o", ylim=c(0, max(dataSumm$uniqSpec)))

There do not look to be any serious issue with this (no drastic changes in, for example, species identification through time).

The following code calculates, using eightMethods.count(), the slope or exponent for each of the original eight methods for each year in turn, and saves a .png plot for each year that shows the fit of each method. It is not run here because it takes a few hours (results are saved as the data object fullResults).

fullYears = unique(data$Year)
fullResults = data.frame()
for(ii in fullYears){
  eightMethodsRes = eightMethods.count(data = data,
                                       oneYear = ii,
                                       figName = "nSeaFung")
  fullResults = rbind(fullResults, eightMethodsRes)
}
# usethis::use_data(fullResults, overwrite = TRUE)    # Run this to save the data.

Now to plot Figure 1, time series of each estimate of b for each method, and fit regression:

trendResults = timeSerPlot.eight()

The results of the regression analyses (Table S.1) are:

knitr::kable(dplyr::select(trendResults, -adjRsquared),
             digits=c(0, 4, 4, 4, 2, 2))
Method Low Trend High p Rsquared
Llin 0.0000 0.0000 0.0000 0.01 0.19
LT -0.0313 0.0052 0.0417 0.77 0.00
LTplus1 -0.0206 0.0058 0.0321 0.66 0.01
LBmiz -0.0060 -0.0034 -0.0009 0.01 0.21
LBbiom -0.0076 -0.0042 -0.0008 0.02 0.19
LBNbiom -0.0076 -0.0042 -0.0008 0.02 0.19
LCD -0.0057 -0.0030 -0.0002 0.04 0.15
MLE -0.0047 -0.0010 0.0027 0.60 0.01